package com.gzyj.jtt808.v2011.enums;

import lombok.Getter;

/**
 *
 * @author lhj
 */
@Getter
public enum AlarmFlag {
    紧急报警_触动报警(1, "紧急报警", "触动报警开关后触发"),
    超速报警(2, "超速报警", "标志维持至报警条件解除"),
    疲劳驾驶报警(4, "疲劳驾驶", "标志维持至报警条件解除"),
    危险驾驶行为报警(8, "预警", "标志维持至报警条件解除"),
    GNSS模块发生故障报警(16, "GNSS模块发生故障", "标志维持至报警条件解除"),
    GNSS天线未接或被剪断报警(32, "GNSS天线未接或被剪断报警", "标志维持至报警条件解除"),
    GNSS天线短路(64, "GNSS天线短路报警", "标志维持至报警条件解除"),
    终端主电源欠压报警(128, "终端主电源欠压", "标志维持至报警条件解除"),
    终端主电源掉电报警(256, "终端主电源掉电", "标志维持至报警条件解除"),
    终端LCD或显示器故障报警(512, "终端LCD或显示器故障", "标志维持至报警条件解除"),
    TTS模块故障报警(1024, "TTS模块故障", "标志维持至报警条件解除"),
    摄像头故障报警(2048, "摄像头故障", "标志维持至报警条件解除"),

    保留(1<<12, "保留", "保留"),
    保留1(1<<13, "保留", "保留"),
    保留2(1<<14, "保留", "保留"),
    保留3(1<<15, "保留", "保留"),
    保留4(1<<16, "保留", "保留"),
    保留5(1<<17, "保留", "保留"),

    当天累计驾驶超时报警(1 << 18, "当天累计驾驶超时报警", "标志维持至报警条件解除"),
    超时停车报警(1 << 19, "超时停车报警", "标志维持至报警条件解除"),
    进出区域报警(1 << 20, "进出区域报警", "收到应答后清零"),
    进出路线报警(1 << 21, "进出路线报警", "收到应答后清零"),
    路段行驶时间不足_过长报警(1 << 22, "路段行驶时间不足/过长报警", "收到应答后清零"),
    路线偏离报警(1 << 23, "路线偏离报警", "标志维持至报警条件解除"),
    车辆VSS故障(1 << 24, "车辆VSS故障", "标志维持至报警条件解除"),
    车辆油量异常报警(1 << 25, "车辆油量异常报警", "标志维持至报警条件解除"),
    车辆被盗报警_通过车辆防盗器(1 << 26, "车辆被盗报警(通过车辆防盗器)", "标志维持至报警条件解除"),
    车辆非法点火报警(1 << 27, "车辆非法点火报警", "收到应答后清零"),
    车辆非法位移报警(1 << 28, "车辆非法位移报警", "收到应答后清零"),

    保留6(1 << 29, "保留", "-"),
    保留7(1 << 30, "保留", "-"),
    保留8(1 << 31, "保留", "-"),

    ;

    private int code;
    private String name;

    private String des;

    AlarmFlag(int code, String name, String des) {
        this.code = code;
        this.name = name;
        this.des = des;
    }

    public static AlarmFlag find(int code) {
        for (AlarmFlag val:AlarmFlag.values()){
            if(code==val.getCode()){
                return val;
            }
        }
        return null;
    }
}
